package kk.learn.scala.work._2

/**
 * <p>
 *
 * </p>
 *
 * @author KK
 * @since 2021-02-21
 */
//noinspection ScalaDeprecation
object GameDriver {

  def main(args: Array[String]): Unit = {

    println("*************猜拳开始*************")
    //  生成玩家（游客）类
    val user: Gamer = Gamer("user", "游客")
    //  根据玩家的选择， 生成电脑玩家
    println("请选择对战角色：（1.刘备  2.关羽  3.张飞）")
    val tag = readInt()
    val computer = tag match {
      case 1 => Gamer("computer", "刘备")
      case 2 => Gamer("computer", "关羽")
      case 3 => Gamer("computer", "张飞")
      case _ =>
        println("输出非法， 默认选择与刘备对战")
        Gamer("computer", "刘备")
    }

    // 进行游戏
    val game = new Game(user, computer)
    game.play()

  }
}
